package com.xiang.design.chainResponsibility.Impl;

import com.xiang.design.chainResponsibility.Handle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * 首席财务官处理
 *
 * @author xiangtianlei
 * @date 2023/03/15
 */
public class CfoHandle implements Handle {
    Logger log = LoggerFactory.getLogger(CfoHandle.class);

    Handle nextHandle;

    /**
     * 设置下一个处理
     *
     * @param handle 处理
     */
    @Override
    public void setNextHandle(Handle handle) {
        this.nextHandle = handle;
    }

    /**
     * 处理
     *
     * @param amount 数量
     * @return boolean
     */
    @Override
    public boolean handle(int amount) {
        if (amount <= 10000) {
            log.warn("首席财务官处理有权限处理,无需上级领导审批");
            return true;
        }
        log.error("最大审批上线1万元,请重新核对后提交审批");
        return false;
    }
}
